<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./css/base.css" />
    <link rel="stylesheet" href="./css/index.css" />
    <link rel="stylesheet" href="./首页字体图标/iconfont.css" />
    <link
      rel="stylesheet"
      href="./第三方/Swiper-3.4.2/dist/css/swiper.min.css"
    />
  </head>
  <body>
    <div id="app">
      <!-- 头部 -->
      <header>
        <div class="head">
          <h2>智慧商城</h2>
        </div>
      </header>
      <!-- 主体 -->
      <main>
        <div class="input">
          <a href="./搜索.html">
            <i class="iconfont icon-search-1-copy"></i>
            <span>请输入搜索内容</span>
          </a>
        </div>
        <!-- 轮播图 -->
        <div class="banner">
          <div class="swiper-container">
            <div class="swiper-wrapper">
              <div class="swiper-slide" v-for="(item,index) in swiPer">
                <a href="#"> <img :src="item.imgUrl" alt="" /></a>
              </div>
            </div>
            <!-- Add Pagination -->
            <div class="swiper-pagination"></div>
          </div>
        </div>

        <!-- 通知 -->
        <div class="notice">
          <i class="iconfont icon-xiaolaba"></i>
          <div class="box">
            <span>智慧商城2.0全新上线，更多新品等你来选~</span>
          </div>
        </div>

        <!-- 内容 -->
        <div class="big">
          <a href="#" v-for="(item,index) in content " :key="item.id">
            <span
              ><img :src="item.imgUrl" alt="" />
              <p>{{item.text}}</p>
            </span>
          </a>
        </div>
        <!-- 小标题 -->
        <div class="venue">
          <img :src="item.imgUrl" alt="" v-for="(item,index) in biaoTi" />
        </div>
        <!-- 猜你喜欢 -->
        <div class="like">
          <p>—— 猜你喜欢 ——</p>
        </div>

        <!-- 手机 -->
        <div class="box1">
          <div class="phone" v-for="(item,index) in list" :key="item.id">
            <a href="#">
              <div class="left">
                <img :src="item.goods_image" alt="" />
              </div>
              <div class="right">
                <span class="ellipsis-2">{{item.goods_name}} </span>
                <p>已售{{item.goods_sales}}件</p>
                <div class="yi">
                  <em>{{item.goods_price_max}}</em>
                  <span
                    v-if="item.line_price_max==='0.00' ? '' : item.line_price_max"
                    >{{item.line_price_max}}</span
                  >
                </div>
              </div>
            </a>
          </div>
        </div>
      </main>
      <!-- 底部 -->
      <footer>
        <a href="#">
          <i class="iconfont icon-shouye"></i>
          <p>首页</p>
        </a>
        <a href="./分类.html">
          <i class="iconfont icon-fenlei"></i>
          <p>分类</p>
        </a>
        <a href="./搜索.html">
          <i class="iconfont icon-gouwuche"></i>
          <p>购物车</p>
        </a>
        <a href="./我的.html">
          <i class="iconfont icon-wode"></i>
          <p>我的</p>
        </a>
      </footer>
    </div>
    <script src="./第三方/Swiper-3.4.2/dist/js/swiper.min.js"></script>
    <script src="./lib/axios.js"></script>
    <script src="./js/vue.js"></script>
    <!-- <script src="./js/index.js"></script> -->
    <script></script>
    <script>
      const app = new Vue({
        el: '#app',
        data: {
          list: [],
          content: [],
          biaoTi: [],
          swiPer: []
        },
        created() {
          this.bookList()
        },
        methods: {
          async bookList() {
            const res = await axios.get(
              'http://cba.itlike.com/public/index.php?s=/api/page/detail'
            )
            // console.log(
            //   '图书列表的数据',
            //   res.data.data.pageData.items[6].data
            // )
            console.log(res.data.data.pageData.items[6].data)
            this.list = res.data.data.pageData.items[6].data
            this.content = res.data.data.pageData.items[3].data
            console.log(res.data.data.pageData.items[4].data)
            this.biaoTi = res.data.data.pageData.items[4].data
            this.swiPer = res.data.data.pageData.items[1].data
          }
        },
        updated() {
          var swiper = new Swiper('.swiper-container', {
            observer: true,
            pagination: '.swiper-pagination',
            nextButton: '.swiper-button-next',
            slidesPerView: 1,
            paginationClickable: true,
            spaceBetween: 30,
            loop: true,
            autoplay: 1000
          })
        }
      })
    </script>
  </body>
</html>
